package gpl.pierrick.brihaye.util;

import java.util.LinkedHashMap;
import java.util.Map.Entry;

public class LRUCache<K, V> extends LinkedHashMap<K, V> {
	private static final long serialVersionUID = -6491126630690225702L;

	private int capacity;
	
	public LRUCache(int capacity) {
		super(capacity*4/3+1,0.75F,true);
		this.capacity = capacity;
	}
	
	@Override
	protected boolean removeEldestEntry(Entry<K, V> eldest) {
		return size()>capacity;
	}
}
